<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>开发者登陆</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<!-- JavaScripts -->
	<script type="text/javascript" src="style/js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="style/js/jNice.js"></script>
  	<script type="text/javascript">	
  		function regUser()
  		{
			//window.location.href='user?actionType=regUser';
			try
			{
				$.ajax({
					type:"get",
					async:false,
					url:"user?actionType=getRegUserDlg",
					dataType:"html",
					success:function(data,textStatus){
						$("div#main").html();
						$("div#main").html(data);
					},
					error:function(){}
				});
			}catch(e){
				alert(e);
				return false ;
			}	
			return false;
  		}
  		
  		function show(o) {
		  	var timenow = new Date().getTime();
		  	o.src = "validatecode?d=" + timenow;
	 	}
	 	function userLogin(){
			var userName = $('input#userName').val().trim();
			var password = $('input#password').val().trim();
			var validCodeAnswer = $('input#validCodeAnswer').val().trim();
			try
			{
				$.ajax({
					type:"get",
					url:"user",
					async:false,
					data:{
					"actionType":"login",
					"userName":userName,
					"password":password,
					"validCodeAnswer":validCodeAnswer
					},
					dataType:"text",
					success:function(data,textStatus){
						if(data == '0')
							window.location.href="user_index.html";
						else
							alert(data);
					},
					error:function(){}
				});
			}catch(e){
				alert(e);
				return false ;
			}	
			return false;
		}
  	</script>
  </head>
  
  <body>
  <div>
		<form action="user" method="GET" name="loginForm" id="loginForm">
       		<input type=hidden id=actionType name=actionType value=login></input>
        	<h3>用户登录</h3>
       		<fieldset>
       			<p>用户名:</p><p><input type="text" name="userName" id="userName" class="text-medium" maxlength=20/></input></p>
       			<p>密码:</p><p><input type="password" name="password" id="password" class="text-medium" maxlength=20/></input></p>
	            <p>验证码:</p><p><input type="text" name="validCodeAnswer" class="text-small" id="validCodeAnswer" value='' maxlength=4></input><img src="validatecode" name="validImg" id="validImg"/><a href="javascript:show(document.getElementById('validImg'))">看不清?</a></p>
	            <p><input type="submit" name="submit" id="submit" value="登陆" onclick="userLogin();return false;"/><input type="button" name="reg" id="reg" value="注册" onClick="regUser(); return false;"/></p>
       		</fieldset>
        </form>
  </div>
  </body>
</html>
